/*
 * Copyright (C) 2010 M. Hautle.
 * 
 * This file is part of TrackedBean.
 * 
 * TrackedBean is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * TrackedBean is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with TrackedBean. If not, see <http://www.gnu.org/licenses/>.
 */
package ch.trackedbean.loaders;

import java.util.*;

/**
 * Listener for data changes.<br>
 * This listener type is used by the {@link DataManager}.
 * 
 * @author M. Hautle
 * @since 08.10.2010
 */
public interface IDataListener extends EventListener {
    /**
     * Called if a somewhat complex change occurred.<br>
     * This means normally you should reload all elements matching the given description.
     * 
     * @param <T> The object type
     * @param <D> The discriminator type
     * @param <K> The key type for the parameter map
     * @param <V> The value type for the parameter map
     * @param type The type of the concerned object
     * @param subType Additional discriminator specifying the "subtype" which is concerned (may be null)
     * @param settings Additional settings describing further details of the concerned elements (may be null)
     */
    <T, D, K, V> void complexChange(Class<T> type, D subType, Map<K, V> settings);

    /**
     * Called if a single object has changed.
     * 
     * @param <T> The object type
     * @param <K> The key type
     * @param type The type of the object which has changed
     * @param key The key of the object which has changed
     */
    <T, K> void changed(Class<T> type, K key);

    /**
     * Called if a single object was created.
     * 
     * @param <T> The object type
     * @param <K> The key type
     * @param type The type of the object which was created
     * @param key The key of the object which was created
     */
    <T, K> void created(Class<T> type, K key);

    /**
     * Called if a single object was removed.
     * 
     * @param <T> The object type
     * @param <K> The key type
     * @param type The type of the object which was removed
     * @param key The key of the object which was removed
     */
    <T, K> void removed(Class<T> type, K key);
}
